package cn.iocoder.yudao.module.trade.dal.mysql.ordertransfer;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.trade.controller.admin.ordertransfer.vo.OrderTransferPageReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.ordertransfer.OrderTransferDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 订单转派记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface OrderTransferMapper extends BaseMapperX<OrderTransferDO> {

    default PageResult<OrderTransferDO> selectPage(OrderTransferPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderTransferDO>()
                .eqIfPresent(OrderTransferDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderTransferDO::getDeliveryUserId, reqVO.getDeliveryUserId())
                .eqIfPresent(OrderTransferDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(OrderTransferDO::getOriginalDeliveryUserId, reqVO.getOriginalDeliveryUserId())
                .eqIfPresent(OrderTransferDO::getOriginalStoreId, reqVO.getOriginalStoreId())
                .betweenIfPresent(OrderTransferDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderTransferDO::getId));
    }

}